package com.service.impl;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.dao.YiShengDao;
import com.entity.YiShengEntity;
import com.entity.view.YonghuView;
import com.entity.vo.YiShengVO;
import com.service.YiShengService;
import com.utils.PageUtils;
import com.utils.Query;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service("yishengService")
public class YiShengServiceImpl extends ServiceImpl<YiShengDao, YiShengEntity> implements YiShengService {


    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        Page<YiShengEntity> page = this.selectPage(
                new Query<YiShengEntity>(params).getPage(),
                new EntityWrapper<YiShengEntity>()
        );
        return new PageUtils(page);
    }

    @Override
    public PageUtils queryPage(Map<String, Object> params, Wrapper<YiShengEntity> wrapper) {
        Page<YonghuView> page = new Query<YonghuView>(params).getPage();
        page.setRecords(baseMapper.selectListView(page, wrapper));
        PageUtils pageUtil = new PageUtils(page);
        return pageUtil;
    }

    @Override
    public List<YiShengVO> selectListVO(Wrapper<YiShengEntity> wrapper) {
        return baseMapper.selectListVO(wrapper);
    }

    @Override
    public YiShengVO selectVO(Wrapper<YiShengEntity> wrapper) {
        return baseMapper.selectVO(wrapper);
    }

    @Override
    public List<YonghuView> selectListView(Wrapper<YiShengEntity> wrapper) {
        return baseMapper.selectListView(wrapper);
    }

    @Override
    public YonghuView selectView(Wrapper<YiShengEntity> wrapper) {
        return baseMapper.selectView(wrapper);
    }

    @Override
    public List<Map<String, Object>> selectValue(Map<String, Object> params, Wrapper<YiShengEntity> wrapper) {
        return baseMapper.selectValue(params, wrapper);
    }

    @Override
    public List<Map<String, Object>> selectTimeStatValue(Map<String, Object> params, Wrapper<YiShengEntity> wrapper) {
        return baseMapper.selectTimeStatValue(params, wrapper);
    }

    @Override
    public List<Map<String, Object>> selectGroup(Map<String, Object> params, Wrapper<YiShengEntity> wrapper) {
        return baseMapper.selectGroup(params, wrapper);
    }

    @Override
    public YiShengEntity selectByName(String receiveUser) {
        YiShengEntity yonghuEntity = new YiShengEntity();
        yonghuEntity.setYonghuxingming(receiveUser);
        return baseMapper.selectOne(yonghuEntity);
    }

}